<template>
	<div class="footer width_img">
		<ul class="width_img text-center">
			<li v-for = "(item,index) in fotNav" class="nummbox">
				<div @click="$router.push(item.pathUrl)" :class="{active : IsActive(item.pathUrl) }">
					<span :class="item.spanClass"></span>
					<span class="numm" v-if="item.inumm && getCarlistAdnum > 0">{{ getCarlistAdnum }}</span>
					{{item.title}}
				</div>
			</li>
		</ul>
	</div>
</template>

<script>
	export default{
		name:"app-footer",
		data(){
			return {
				isindex : '',
				fotNav : [
					{
						"title" :"主页",
						"pathUrl" : "/home",
						"pathName" : "home",
						"spanClass" : "iconfont icon-shouye"
					},
					{
						"title" :"分类",
						"pathUrl" : "/classname",
						"pathName" : "/classname",
						"spanClass" : "iconfont icon-fenlei"
					},
					{
						"title" :"购物车",
						"pathUrl" : "/shopcar",
						"pathName" : "shopcar",
						"spanClass" : "iconfont icon-gouwuche",
						"inumm" : true
					},
					{
						"title" :"我的",
						"pathUrl" : "/mine",
						"pathName" : "mine",
						"spanClass" : "iconfont icon-smile"
					},
				]
			}
		},
		computed:{
			getCarlistAdnum(){//返回购物车总件数
				return this.$store.getters.getCarlistAdnum
			}
		},
		methods:{
			openlink(link){
			 	this.$router.push(link)
			},
			IsActive(url){
				// console.log(url)
				// console.log(location.href)
				// console.log(location.href.indexOf(url))
				if(location.href.indexOf(url,7) != -1){
					return true
				}
			}
		}
	}
</script>

<style>
.nummbox{
	position: relative;
}

</style>